package com.ehl.utb.cloud.test.db;

import com.baomidou.mybatisplus.extension.incrementer.OracleKeyGenerator;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * Class {@link }
 * <p>
 * Created by Gensokyo V.L. on 2020/04/24.
 *
 * @author Gensokyo V.L.
 * @version 1.36
 * @since 2020/04/24
 **/
@EnableTransactionManagement
@Configuration
@MapperScan("com.ehl.utb.cloud.test.db.mapper*")
public class DbConfig {

    /**
     * 配置Mybatis 分页插件
     *
     * @return PaginationInterceptor
     */
    @ConditionalOnMissingBean
    @Bean
    public static PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

    /**
     * 配置 Oracle 主键生成器
     *
     * @return OracleKeyGenerator
     */
    @ConditionalOnMissingBean
    @Bean
    public OracleKeyGenerator getOracleKeyGenerator() {
        return new OracleKeyGenerator();
    }



}
